<HTML>
<CENTER><A HREF = "http://sparta.sandia.gov">SPARTA WWW Site</A> - <A HREF = "Manual.html">SPARTA Documentation</A> - <A HREF = "Section_commands.html#comm">SPARTA Commands</A> 
</CENTER>






<HR>

<H3>fix command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>fix ID style args 
</PRE>
<UL><LI>ID = user-assigned name for the fix
<LI>style = one of a long list of possible style names (see below)
<LI>args = arguments used by a particular style 
</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 1 grid/check 100 warn
fix 1 ave/time all 100 5 1000 c_myTemp c_thermo_temp file temp.profile 
</PRE>
<P><B>Description:</B>
</P>
<P>Set a fix that will be applied to the system.  In SPARTA, a "fix" is
an operation that is applied to the system during timestepping.
Examples include adding particles via inlet boundary conditions or
computing diagnostics.  Code for new fixes can be added to SPARTA; see
<A HREF = "Section_modify.html">Section 10</A> of the manual for details.
</P>
<P>Fixes perform their operations at different stages of the timestep.
If 2 or more fixes operate at the same stage of the timestep, they are
invoked in the order they were specified in the input script.
</P>
<P>The ID for a fix is used to identify the fix in other commands.  Each
fix ID must be unique; see an exception below.  The ID can only
contain alphanumeric characters and underscores.  You can specify
multiple fixes of the same style so long as they have different IDs.
A fix can be deleted with the <A HREF = "unfix.html">unfix</A> command, after which
its ID can be re-used.
</P>
<P>IMPORTANT NOTE: The <A HREF = "unfix.html">unfix</A> command is the only way to turn
off a fix; simply specifying a new fix with the same style and a
different ID will not turn off the first one.
</P>
<P>If you specify a new fix with the same ID and style as an existing
fix, the old fix is deleted and the new one is created (presumably
with new settings).  This is the same as if an "unfix" command were
first performed on the old fix, except that the new fix is kept in the
same order relative to the existing fixes as the old one originally
was.
</P>
<P>Some fixes store an internal "state" which is written to binary
restart files via the <A HREF = "restart.html">restart</A> or
<A HREF = "write_restart.html">write_restart</A> commands.  This allows the fix to
continue on with its calculations in a restarted simulation.  See the
<A HREF = "read_restart.html">read_restart</A> command for info on how to re-specify
a fix in an input script that reads a restart file.  See the doc pages
for individual fixes for info on which ones can be restarted.
</P>
<HR>

<P>Each fix style has its own doc page which describes its arguments and
what it does, as listed below.  Here is an alphabetic list of fix
styles available in SPARTA:
</P>
<UL><LI><A HREF = "fix_adapt.html">adapt</A> - on-the-fly grid adaptation
<LI><A HREF = "fix_adapt.html">adapt/kk</A> - Kokkos version of fix adapt
<LI><A HREF = "fix_ambipolar.html">ambipolar</A> - ambipolar approximation for ionized plasmas
<LI><A HREF = "fix_ave_grid.html">ave/grid</A> - compute per grid cell time-averaged quantities
<LI><A HREF = "fix_ave_grid.html">ave/grid/kk</A> - Kokkos version of fix ave/grid
<LI><A HREF = "fix_ave_histo.html">ave/histo</A> - compute/output time averaged histograms
<LI><A HREF = "fix_ave_histo.html">ave/histo/weight</A> - compute/output weighted histograms
<LI><A HREF = "fix_ave_surf.html">ave/surf</A> - compute per surface element time-averaged quantities
<LI><A HREF = "fix_ave_time.html">ave/time</A> - compute/output global time-averaged quantities
<LI><A HREF = "fix_balance.html">balance</A> - perform dynamic load-balancing
<LI><A HREF = "fix_balance.html">balance/kk</A> - Kokkos version of fix balance
<LI><A HREF = "fix_emit_face.html">emit/face</A> - emit particles at global boundaries
<LI><A HREF = "fix_emit_face.html">emit/face/kk</A> - Kokkos version of fix emit/face
<LI><A HREF = "fix_emit_face_file.html">emit/face/file</A> - emit particles at global boundaries using a distribution defined in a file
<LI><A HREF = "fix_emit_surf.html">emit/surf</A> - emit particles at surfaces
<LI><A HREF = "fix_grid_check.html">grid/check</A> - check if particles are in the correct grid cell
<LI><A HREF = "fix_grid_check.html">grid/check/kk</A> - Kokkos version of fix grid/check
<LI><A HREF = "fix_move_surf.html">move/surf</A> - move surfaces dynamically during a simulation
<LI><A HREF = "fix_move_surf.html">move/surf/kk</A> - Kokkos version of fix move/surf
<LI><A HREF = "fix_print.html">print</A> - print text and variables during a simulation
<LI><A HREF = "fix_vibmode.html">vibmode</A> - discrete vibrational energy modes 
</UL>
<P>There are also additional accelerated compute styles included in the
SPARTA distribution for faster performance on specific hardware.  The
list of these with links to the individual styles are given in the
pair section of <A HREF = "Section_commands.html#cmd_5">this page</A>.
</P>
<HR>

<P>In addition to the operation they perform, some fixes also produce one
of four styles of quantities: global, per-particle, per-grid, or
per-surf.  These can be used by other commands or output as described
below.  A global quantity is one or more system-wide values, e.g. the
temperature of the system.  A per-particle quantity is one or more
values per particle, e.g. the kinetic energy of each particle.  A
per-grid quantity is one or more values per grid cell.  A per-surf
quantity is one or more values per surface element.
</P>
<P>Global, per-particle, per-grid, and per-surf quantities each come in
two forms: a single scalar value or a vector of values.  Additionaly,
global quantities can also be a 2d array of values.  The doc page for
each fix describes the style and kind of values it produces, e.g. a
per-particle vector.  Some fixes can produce more than one form of a
single style, e.g. a global scalar and a global vector.
</P>
<P>When a fix quantity is accessed, as in many of the output commands
discussed below, it can be referenced via the following bracket
notation, where ID is the ID of the fix:
</P>
<DIV ALIGN=center><TABLE  BORDER=1 >
<TR><TD >f_ID </TD><TD > entire scalar, vector, or array</TD></TR>
<TR><TD >f_ID[I] </TD><TD > one element of vector, one column of array</TD></TR>
<TR><TD >f_ID[I][J] </TD><TD > one element of array 
</TD></TR></TABLE></DIV>

<P>In other words, using one bracket reduces the dimension of the
quantity once (vector -> scalar, array -> vector).  Using two brackets
reduces the dimension twice (array -> scalar).  Thus a command that
uses scalar fix values as input can also process elements of a vector
or array.
</P>
<P>Note that commands and <A HREF = "variable.html">variables</A> which use fix
quantities typically do not allow for all kinds, e.g. a command may
require a vector of values, not a scalar.  This means there is no
ambiguity about referring to a fix quantity as f_ID even if it
produces, for example, both a scalar and vector.  The doc pages for
various commands explain the details.
</P>
<HR>

<P>Any values generated by a fix can be used in several ways:
</P>
<UL><LI>Global values can be output via the <A HREF = "stats_style.html">stats_style</A>
command.  Or the values can be referenced in a <A HREF = "variable.html">variable
equal</A> or <A HREF = "variable.html">variable atom</A> command. 

<LI>Per-particle values can be output via the <A HREF = "dump.html">dump particle</A>
command.  Or the per-particle values can be referenced in an
<A HREF = "variable.html">particle-style variable</A>. 

<LI>Per-grid values can be output via the <A HREF = "dump.html">dump grid</A> command.
Or the per-grid values can be referenced in a <A HREF = "variable.html">grid-style
variable</A>. 
</UL>
<HR>

<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "unfix.html">unfix</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>
